package com.guoxin.chapter2.setnewpropertieslockone;

/**
 * @author guoxin
 * @date 2019年8月20日
 */
public class Run {
	public static void main(String[] args) throws InterruptedException {
		UserInfo userInfo = new UserInfo();
		userInfo.setUsername("adfsdfd");
		Service service = new Service();

		Thread t1 = new Thread(new Runnable() {
			public void run() {
				service.testMethod(userInfo);
			}
		}, "T1");

		Thread t2 = new Thread(new Runnable() {

			@Override
			public void run() {
				service.testMethod(userInfo);
			}
		}, "T2");

		t1.start();
		Thread.sleep(50);
		t2.start();
	}
}
